<script type="text/javascript" src="../Public/Js/common.js"></script>
<if condition="$groupinfo['brower_level'] eq -1">
{:W('Weibo',array('tpl_name'=>'group_share_weibo','button_title'=>'分享'))}
</if>
<script>
<if condition="$is_invited eq 1">
$(document).ready(function(){
	joingroup({$gid});
});
</if>
</script>
<style type="text/css">
.clearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;}
.clearfix {zoom:1;}
ul,li {list-style:none;}
img {border:0;}
.ad {width:468px; margin:10px auto 0;}
.ad li {padding-top:5px;}
h1 {height:50px; line-height:50px; font-size:22px; font-weight:normal; font-family:"Microsoft YaHei",SimHei;}
.shuoming {margin-top:20px; border:1px solid #ccc; padding-bottom:10px;}
.shuoming dt {height:30px; line-height:30px; font-weight:bold; text-indent:10px;}
.shuoming dd {line-height:20px; padding:5px 20px;}
.wrapper {width:600px;}
/* tmall focus */
#focus {width:600px; height:200px; overflow:hidden; position:relative; margin:0 auto 0 135px; }
#focus ul {height:200px; position:absolute;}
#focus ul li {float:left; width:600px; height:200px; overflow:hidden; position:relative; background:#000;}
#focus ul li p {position:absolute; overflow:hidden; bottom:0;}
#focus .btnBg {position:absolute; width:600px; height:24px; left:0; bottom:0; background:#000;}
#focus .btn {position:absolute; width:590px; height:16px; left:0; bottom:4px; padding-left:10px;}
#focus .btn span {display:inline-block; _display:inline; _zoom:1; width:16px; height:16px; line-height:16px; text-align:center; font-size:12px; font-family:"Microsoft YaHei",SimHei; margin-right:10px; cursor:pointer; color:#fff;}
#focus .btn span.on {background:#000; color:#fcc;}
</style>
<script type="text/javascript">
$(function() {
	var sWidth = $("#focus").width(); //获取焦点图的宽度（显示面积）
	var len = $("#focus ul li").length; //获取焦点图个数
	var index = 0;
	var picTimer;
	
	//以下代码添加数字按钮和按钮后的半透明长条
	var btn = "<div class='btnBg'></div><div class='btn'>";
	for(var i=0; i < len; i++) {
		btn += "<span>" + (i+1) + "</span>";
	}
	btn += "</div>"
	$("#focus").append(btn);
	$("#focus .btnBg").css("opacity",0.5);
	
	//为数字按钮添加鼠标滑入事件，以显示相应的内容
	$("#focus .btn span").mouseenter(function() {
		index = $("#focus .btn span").index(this);
		showPics(index);
	}).eq(0).trigger("mouseenter");
	
	//本例为左右滚动，即所有li元素都是在同一排向左浮动，所以这里需要计算出外围ul元素的宽度
	$("#focus ul").css("width",sWidth * (len + 1));
	
	//鼠标滑入某li中的某div里，调整其同辈div元素的透明度，由于li的背景为黑色，所以会有变暗的效果
	$("#focus ul li p").hover(function() {
		$(this).siblings().css("opacity",0.7);
	},function() {
		$("#focus ul li p").css("opacity",1);
	});
	
	//鼠标滑上焦点图时停止自动播放，滑出时开始自动播放
	$("#focus").hover(function() {
		clearInterval(picTimer);
	},function() {
		picTimer = setInterval(function() {
			if(index == len) { //如果索引值等于li元素个数，说明最后一张图播放完毕，接下来要显示第一张图，即调用showFirPic()，然后将索引值清零
				showFirPic();
				index = 0;
			} else { //如果索引值不等于li元素个数，按普通状态切换，调用showPics()
				showPics(index);
			}
			index++;
		},3000); //此3000代表自动播放的间隔，单位：毫秒
	}).trigger("mouseleave");
	
	//显示图片函数，根据接收的index值显示相应的内容
	function showPics(index) { //普通切换
		var nowLeft = -index*sWidth; //根据index值计算ul元素的left值
		$("#focus ul").stop(true,false).animate({"left":nowLeft},500); //通过animate()调整ul元素滚动到计算出的position
		$("#focus .btn span").removeClass("on").eq(index).addClass("on"); //为当前的按钮切换到选中的效果
	}
	
	function showFirPic() { //最后一张图自动切换到第一张图时专用
		$("#focus ul").append($("#focus ul li:first").clone());
		var nowLeft = -len*sWidth; //通过li元素个数计算ul元素的left值，也就是最后一个li元素的右边
		$("#focus ul").stop(true,false).animate({"left":nowLeft},500,function() {
			//通过callback，在动画结束后把ul元素重新定位到起点，然后删除最后一个复制过去的元素
			$("#focus ul").css("left","0");
			$("#focus ul li:last").remove();
		}); 
		$("#focus .btn span").removeClass("on").eq(0).addClass("on"); //为第一个按钮添加选中的效果
	}
});
</script>
<div class="M_group clearfix">
<!-- page_title begin -->
    <dl class="T_group">
        <dt class="userPic">
            <a href="{:U('group/Group/index', array('gid'=>$gid))}"><img src="__ROOT__/thumb.php?w=80&h=80&url={$groupinfo['logo']|get_photo_url}"/></a>
        </dt>
        <dd class="userInfo">
        <div class="right alR">
            <div class="mb10">	    
                <if condition="$groupinfo['brower_level'] eq -1">
                    <php>
                        $tpl_data = array('author'=>getUserName($groupinfo['uid']),'name'=>$groupinfo['name'],'url'=>U('group/Group/index',array('gid'=>$gid)));
                        $tpl_data = urlencode(serialize($tpl_data));
                    </php>
                    <a href="javascript:void(0)" onclick="_widget_weibo_start('', '{$tpl_data}');">分享群组</a>
                    
                </if>
                <php>if (($ismember && $groupinfo['need_invite'] != 2) || $isadmin) { </php>
                    &nbsp;&nbsp;<span class="cGray2">|</span>&nbsp;&nbsp;<a href="{:U('group/Invite/create',array('gid'=>$groupinfo['id']))}">邀请好友</a>
                    
                <php>}</php>
                <php>if($isadmin){</php>&nbsp;&nbsp;<span class="cGray2">|</span>&nbsp;&nbsp;
                    <span class="ico_Modify"></span><a href="{:U('/Manage/',array('gid'=>$groupinfo['id']))}">管理群组</a>
                    
                <php>}</php>
                <php>if(!isadmin($mid,$gid) && !ismember($mid,$gid)){</php>
                    <php>if($groupinfo['membercount'] == $config['groupMaxUser']){</php>
                        &nbsp;&nbsp;<span class="cGray2">|</span>&nbsp;&nbsp;人数已经满({$groupinfo['membercount']})
                    <php>}else{</php>
                        &nbsp;&nbsp;<span class="cGray2">|</span>&nbsp;&nbsp;<a href="javascript:joingroup({$gid})" class="btn_shenqing"><span class="addnew">+</span>加入该群</a>
                    <php>}</php>
                <php>} elseif(iscreater($mid,$gid)){</php>
                    
                <php>} else {</php>
                    &nbsp;&nbsp;<span class="cGray2">|</span>&nbsp;&nbsp;<span class="cGray2">已加入群组</span> <a href="javascript:quitgroup({$gid})">退出</a>
                <php>}</php>
            </div>
    
          </div>
            <h1 class="f18px"><a href="{:U('group/Group/index', array('gid'=>$gid))}">{$groupinfo['name']}</a> <span  class="f12px cGray2 fw100 fn">({$groupinfo['membercount']}人)</span></h1>
            <p class="cGray"><if condition=" $groupinfo['need_invite'] eq 1 "> <if condition=" $isadmin ">等待审核成员：{$gid|getApplyCount}人</if></if>         </p>
            
            <p class="cGray">创建时间：{$groupinfo['ctime']|friendlyDate}</p>
            <div class="roundbgF6">群介绍：{$groupinfo['intro']}</p>
            
        </dd>
		<!--中部滚图开始add by vipin-->
		<div id="focus">
			<ul>
			  <volist name="ts['ad']['middle']" id="vo">
			  <li>{$vo.content}</li>
			  </volist>
			</ul>
		</div>
		<!--中部滚图结束add by vipin-->
        <div class="roundbgFc lineAnn">
            <div class="right">
                  <php>if ($isadmin) {</php>
                  <a href="{:U('group/Manage/announce', array('gid'=>$gid))}">修改</a>
                  <php>}</php>
            </div>
            <h4 class="titround_Ann">最新公告</h4>
            <span>{$groupinfo['announce']}</span>
        </div>
    </dl>
    
<!-- page_title end -->

  <div class="tab-menu"><!-- 切换标签 begin  -->
    <if condition="!$search_key && ACTION_NAME neq 'search' && MODULE_NAME neq 'Member'">
	  	<php>
	  	$search_title = '搜索';
	  	switch(strtolower(MODULE_NAME)) {
	  		case 'group':
	  			$search_title = '搜群聊';
	  			break;
	  		case 'topic':
	  			$search_title = '搜帖子';
	  			break;
	  		case 'dir':
	  			$search_title = '搜文件';
	  			break;
	  		default:
	  			$search_title = '搜索';
	  	}
	  	</php>
	  	<span class="searchGroup">
	  	<form 
			<if condition="MODULE_NAME eq 'Group'">action="{:U('group/Group/search', array('gid'=>$groupinfo['id']))}"
	  		<elseif condition="MODULE_NAME eq 'Topic'" />action="{:U('group/Topic/index', array('gid'=>$groupinfo['id']))}"
	  		<elseif condition="MODULE_NAME eq 'Dir'" />action="{:U('group/Dir/index', array('gid'=>$groupinfo['id']))}"</if> 
	  	method="post" onsubmit="javascript:if(this.k.value.length <= 0){return false;}">
	  		<input type="text" name="k"  value="" class="textSearch" />
            <input type="submit" value="" class="btn_s" /><!--{$search_title}-->
	  	</form>
	  	</span>
  	</if>
      <ul>
	      <if condition="$groupinfo['openWeibo']"><li><a href="{:U('/Group/',array('gid'=>$groupinfo['id']))}" <if condition="$current eq 'group'">class="on" </if> > <span>群聊</span></a></li></if>
	      <if condition="$groupinfo['openBlog']"><li><a href="{:U('/Topic/',array('gid'=>$groupinfo['id']))}" <if condition="$current eq 'topic'">class="on" </if>><span>帖子</span></a></li></if>
	      <if condition="$groupinfo['openUploadFile']"><li><a href="{:U('/Dir/',array('gid'=>$groupinfo['id']))}" <if condition="$current eq 'dir'">class="on" </if> ><span>文档</span></a></li></if>
	      <li><a href="{:U('/Member/',array('gid'=>$groupinfo['id']))}" <if condition="$current eq 'member'">class="on" </if> ><span>成员</span></a></li>
      </ul>
  </div><!-- 切换标签 end  -->
